/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.ajz.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.common.utils.excel.annotation.ExcelField;
import com.jeesite.common.utils.excel.annotation.ExcelFields;
import com.jeesite.common.utils.excel.fieldtype.OfficeType;
import com.jeesite.modules.sys.entity.Office;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.util.Date;

/**
 * 出租屋信息Entity
 *
 * @author hhx
 * @version 2019-06-27
 */
@Table(name = "ajz_house_info", alias = "a", columns = {
        @Column(name = "id", attrName = "id", label = "id", isPK = true),
        @Column(name = "addr", attrName = "addr", label = "地址", queryType = QueryType.LIKE),
        @Column(name = "rented_room_num", attrName = "rentedRoomNum", label = "出租屋数量"),
        @Column(name = "room_total", attrName = "roomTotal", label = "房间总数"),
        @Column(name = "floor_count", attrName = "floorCount", label = "楼层高度"),
        @Column(name = "area", attrName = "area", label = "面积"),
        @Column(name = "charge_person", attrName = "chargePerson", label = "负责人", queryType = QueryType.LIKE),
        @Column(name = "charge_person_tel", attrName = "chargePersonTel", label = "负责人电话"),
        @Column(name = "contact_person", attrName = "contactPerson", label = "联系人", queryType = QueryType.LIKE),
        @Column(name = "contact_person_tel", attrName = "contactPersonTel", label = "联系人电话", queryType = QueryType.LIKE),
        @Column(name = "house_type", attrName = "houseType", label = "房屋类别"),
        @Column(name = "danger_lev", attrName = "dangerLev", label = "隐患等级"),
        @Column(name = "longitude", attrName = "longitude", label = "经度"),
        @Column(name = "dimension", attrName = "dimension", label = "维度"),
        @Column(name = "office_code", attrName = "office.officeCode", label = "部门id"),
        @Column(name = "openid", attrName = "openid", label = "联系人微信"),
        @Column(name = "check_status", attrName = "checkStatus", label = "检查状态"),
        @Column(name = "cycle_index", attrName = "cycleIndex", label = "完成第几轮排查"),
        @Column(name = "cycle_ajz_index", attrName = "cycleAjzIndex", label = "计划第几轮排查"),
        @Column(name = "deadline", attrName = "deadline", label = "整改截止时间"),
        @Column(name = "is_trouble", attrName = "isTrouble", label = "是否包含隐患点"),
        @Column(includeEntity = DataEntity.class),
        @Column(name = "back_upa", attrName = "backUpa", label = "back_upa"),
        @Column(name = "back_upb", attrName = "backUpb", label = "back_upb"),
        @Column(name = "back_upc", attrName = "backUpc", label = "back_upc"),
        @Column(name = "back_upd", attrName = "backUpd", label = "back_upd"),
        @Column(name = "back_upe", attrName = "backUpe", label = "back_upe"),
        @Column(name = "back_upf", attrName = "backUpf", label = "back_upf"),
}, joinTable = {
        @JoinTable(type = Type.LEFT_JOIN, entity = Office.class, attrName = "office", alias = "u15",
                on = "u15.office_code = a.office_code", columns = {
                @Column(name = "office_code", label = "机构编码", isPK = true),
                @Column(name = "office_name", label = "机构名称", isQuery = false),
                @Column(name = "parent_code", label = "父级机构名称", isQuery = false),
        }), @JoinTable(type = Type.LEFT_JOIN, entity = AjzRecord.class, alias = "record", attrName = "ajzRecord",
        on = "a.id = record.base_id AND record.base_type= 'house' and record.table_type=#{ajzRecord.tableType}", columns = {
        @Column(name = "id", attrName = "id", label = "id", isPK = true),
        @Column(includeEntity = DataEntity.class),
        @Column(name = "base_type", attrName = "baseType", label = "安监类型"),
        @Column(name = "deadline", attrName = "deadline", label = "截止时间", queryType = QueryType.GTE),
        @Column(name = "opinion", attrName = "opinion", label = "整改意见"),
        @Column(name = "base_id", attrName = "ajzHouseInfo.id", label = "基础表id"),
        @Column(name = "cycle_index", attrName = "cycleIndex", label = "排查轮数"),
        @Column(name = "cycle_count", attrName = "cycleCount", label = "排查次数"),
        @Column(name = "cycle_ajz_index", attrName = "cycleAjzIndex", label = "安监总轮数"),
        @Column(name = "check_status", attrName = "checkStatus", label = "检查状态"),
        @Column(name = "table_type", attrName = "tableType", label = "安监类型"),
        @Column(name = "message_push", attrName = "messagePush", label = "是否推送消息"),
}), @JoinTable(type = Type.LEFT_JOIN, entity = AjzNaturalGas.class, attrName = "ajzNaturalGas", alias = "ajzNaturalGas",
        on = "ajzNaturalGas.base_id = a.id", columns = {
        @Column(name = "id", attrName = "id", label = "id", isPK = true),
        @Column(name = "natural_gas_nature", attrName = "naturalGasNature", label = "天然气性质"),
        @Column(name = "natural_gas_contract", attrName = "naturalGasContract", label = "天然气合同"),
}), @JoinTable(type = Type.LEFT_JOIN, entity = AjzFoodSafety.class, attrName = "ajzFoodSafety", alias = "ajzFoodSafety",
        on = "ajzFoodSafety.base_id = a.id", columns = {
        @Column(name = "id", attrName = "id", label = "id", isPK = true),
        @Column(name = "id", attrName = "id", label = "液化气表id", isPK = true),
        @Column(name = "health_certificate", attrName = "healthCertificate", label = "健康证"),
}), @JoinTable(type = Type.LEFT_JOIN, entity = AjzLiquefiedGas.class, attrName = "ajzLiquefiedGas", alias = "ajzLiquefiedGas",
        on = "ajzLiquefiedGas.base_id = a.id", columns = {
        @Column(name = "id", attrName = "id", label = "id", isPK = true),
        @Column(name = "liquefied_gas_nature", attrName = "liquefiedGasNature", label = "液化气性质"),
        @Column(name = "liquefied_gas_contract", attrName = "liquefiedGasContract", label = "液化气合同"),
}),
}, orderBy = "a.update_date DESC"
)
public class AjzHouseInfo extends DataEntity<AjzHouseInfo> {

    private static final long serialVersionUID = 1L;
    private String addr;        // 地址
    private String rentedRoomNum;        // 出租屋数量
    private String roomTotal;        // 房间总数
    private String floorCount;        // 楼层高度
    private String area;        // 面积
    private String chargePerson;        // 负责人
    private String chargePersonTel;        // 负责人电话
    private String contactPerson;        // 联系人
    private String contactPersonTel;        // 联系人电话
    private String houseType;        // 房屋类别
    private String dangerLev;        // 隐患等级
    private String longitude;        // 经度
    private String dimension;        // 维度
    private Office office;        // 部门id
    private String openid;        // 联系人微信
    private String checkStatus;        // 检查状态
    private String cycleIndex;        // 完成第几轮排查
    private String cycleAjzIndex;        // 计划第几轮排查
    private Date deadline;        // 整改截止时间
    private String isTrouble;        // 是否包含隐患点
    private String backUpa;        // back_upa
    private String backUpb;        // back_upb
    private String backUpc;        // back_upc
    private String backUpd;        // back_upd
    private String backUpe;        // back_upe
    private String backUpf;        // back_upf

    private AjzRecord ajzRecord;
    private AjzFoodSafety ajzFoodSafety;
    private AjzNaturalGas ajzNaturalGas;
    private AjzLiquefiedGas ajzLiquefiedGas;

    /*为专题列表上的四个专题提供的属性*/
    private int all;
    private int uninspect;
    private int uncheck;
    private int checked;

    public int getAll() {
        return all;
    }

    public void setAll(int all) {
        this.all = all;
    }

    public int getUninspect() {
        return uninspect;
    }

    public void setUninspect(int uninspect) {
        this.uninspect = uninspect;
    }

    public int getUncheck() {
        return uncheck;
    }

    public void setUncheck(int uncheck) {
        this.uncheck = uncheck;
    }

    public int getChecked() {
        return checked;
    }

    public void setChecked(int checked) {
        this.checked = checked;
    }

    public AjzHouseInfo() {
        this(null);
    }

    public AjzHouseInfo(String id) {
        super(id);
    }
    @ExcelFields({
            @ExcelField(title = "负责人", attrName = "chargePerson", align = ExcelField.Align.CENTER, sort = 10),
            @ExcelField(title = "负责人电话", attrName = "chargePersonTel", align = ExcelField.Align.CENTER, sort = 20),
            @ExcelField(title = "联系人", attrName = "contactPerson", align = ExcelField.Align.CENTER, sort = 30),
            @ExcelField(title = "联系人电话", attrName = "contactPersonTel", align = ExcelField.Align.CENTER, sort = 40),
            @ExcelField(title = "地址", attrName = "addr", align = ExcelField.Align.CENTER, sort = 50),
            @ExcelField(title = "房间总数", attrName = "roomTotal", align = ExcelField.Align.CENTER, sort = 60),
            @ExcelField(title = "已出租房间数量", attrName = "rentedRoomNum", align = ExcelField.Align.CENTER, sort = 70, fieldType = OfficeType.class),
            @ExcelField(title = "楼层高度", attrName = "floorCount", align = ExcelField.Align.CENTER, sort = 80),
            @ExcelField(title = "面积", attrName = "area", align = ExcelField.Align.CENTER, sort = 90),
            @ExcelField(title = "出租屋类别", attrName = "houseType", align = ExcelField.Align.CENTER, sort = 100),
    })

    @NotBlank(message = "地址不能为空")
    @Length(min = 0, max = 64, message = "地址长度不能超过 64 个字符")
    public String getAddr() {
        return addr;
    }

    public void setAddr(String addr) {
        this.addr = addr;
    }

    @Length(min = 0, max = 10, message = "出租屋数量长度不能超过 10 个字符")
    public String getRentedRoomNum() {
        return rentedRoomNum;
    }

    public void setRentedRoomNum(String rentedRoomNum) {
        this.rentedRoomNum = rentedRoomNum;
    }

    @Length(min = 0, max = 10, message = "房间总数长度不能超过 10 个字符")
    public String getRoomTotal() {
        return roomTotal;
    }

    public void setRoomTotal(String roomTotal) {
        this.roomTotal = roomTotal;
    }

    @Length(min = 0, max = 255, message = "楼层高度长度不能超过 255 个字符")
    public String getFloorCount() {
        return floorCount;
    }

    public void setFloorCount(String floorCount) {
        this.floorCount = floorCount;
    }

    @Length(min = 0, max = 64, message = "面积长度不能超过 64 个字符")
    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    @NotBlank(message = "负责人不能为空")
    @Length(min = 0, max = 100, message = "负责人长度不能超过 100 个字符")
    public String getChargePerson() {
        return chargePerson;
    }

    public void setChargePerson(String chargePerson) {
        this.chargePerson = chargePerson;
    }

    @NotBlank(message = "负责人电话不能为空")
    @Length(min = 0, max = 20, message = "负责人电话长度不能超过 20 个字符")
    public String getChargePersonTel() {
        return chargePersonTel;
    }

    public void setChargePersonTel(String chargePersonTel) {
        this.chargePersonTel = chargePersonTel;
    }

    @Length(min = 0, max = 64, message = "联系人长度不能超过 64 个字符")
    public String getContactPerson() {
        return contactPerson;
    }

    public void setContactPerson(String contactPerson) {
        this.contactPerson = contactPerson;
    }

    @Length(min = 0, max = 255, message = "联系人电话长度不能超过 255 个字符")
    public String getContactPersonTel() {
        return contactPersonTel;
    }

    public void setContactPersonTel(String contactPersonTel) {
        this.contactPersonTel = contactPersonTel;
    }

    @Length(min = 0, max = 255, message = "房屋类别长度不能超过 255 个字符")
    public String getHouseType() {
        return houseType;
    }

    public void setHouseType(String houseType) {
        this.houseType = houseType;
    }

    @Length(min = 0, max = 255, message = "隐患等级长度不能超过 255 个字符")
    public String getDangerLev() {
        return dangerLev;
    }

    public void setDangerLev(String dangerLev) {
        this.dangerLev = dangerLev;
    }

    @Length(min = 0, max = 64, message = "经度长度不能超过 64 个字符")
    public String getLongitude() {
        return longitude;
    }

    public void setLongitude(String longitude) {
        this.longitude = longitude;
    }

    @Length(min = 0, max = 64, message = "维度长度不能超过 64 个字符")
    public String getDimension() {
        return dimension;
    }

    public void setDimension(String dimension) {
        this.dimension = dimension;
    }

    public Office getOffice() {
        return office;
    }

    public void setOffice(Office office) {
        this.office = office;
    }

    @Length(min = 0, max = 255, message = "联系人微信长度不能超过 255 个字符")
    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    @Length(min = 0, max = 10, message = "检查状态长度不能超过 10 个字符")
    public String getCheckStatus() {
        return checkStatus;
    }

    public void setCheckStatus(String checkStatus) {
        this.checkStatus = checkStatus;
    }

    @Length(min = 0, max = 10, message = "完成第几轮排查长度不能超过 10 个字符")
    public String getCycleIndex() {
        return cycleIndex;
    }

    public void setCycleIndex(String cycleIndex) {
        this.cycleIndex = cycleIndex;
    }

    @Length(min = 0, max = 255, message = "计划第几轮排查长度不能超过 255 个字符")
    public String getCycleAjzIndex() {
        return cycleAjzIndex;
    }

    public void setCycleAjzIndex(String cycleAjzIndex) {
        this.cycleAjzIndex = cycleAjzIndex;
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    public Date getDeadline() {
        return deadline;
    }

    public void setDeadline(Date deadline) {
        this.deadline = deadline;
    }

    @Length(min = 0, max = 1, message = "是否包含隐患点长度不能超过 1 个字符")
    public String getIsTrouble() {
        return isTrouble;
    }

    public void setIsTrouble(String isTrouble) {
        this.isTrouble = isTrouble;
    }

    @Length(min = 0, max = 255, message = "back_upa长度不能超过 255 个字符")
    public String getBackUpa() {
        return backUpa;
    }

    public void setBackUpa(String backUpa) {
        this.backUpa = backUpa;
    }

    @Length(min = 0, max = 255, message = "back_upb长度不能超过 255 个字符")
    public String getBackUpb() {
        return backUpb;
    }

    public void setBackUpb(String backUpb) {
        this.backUpb = backUpb;
    }

    @Length(min = 0, max = 255, message = "back_upc长度不能超过 255 个字符")
    public String getBackUpc() {
        return backUpc;
    }

    public void setBackUpc(String backUpc) {
        this.backUpc = backUpc;
    }

    @Length(min = 0, max = 255, message = "back_upd长度不能超过 255 个字符")
    public String getBackUpd() {
        return backUpd;
    }

    public void setBackUpd(String backUpd) {
        this.backUpd = backUpd;
    }

    @Length(min = 0, max = 255, message = "back_upe长度不能超过 255 个字符")
    public String getBackUpe() {
        return backUpe;
    }

    public void setBackUpe(String backUpe) {
        this.backUpe = backUpe;
    }

    @Length(min = 0, max = 255, message = "back_upf长度不能超过 255 个字符")
    public String getBackUpf() {
        return backUpf;
    }

    public void setBackUpf(String backUpf) {
        this.backUpf = backUpf;
    }

    public AjzRecord getAjzRecord() {
        return ajzRecord;
    }

    public void setAjzRecord(AjzRecord ajzRecord) {
        this.ajzRecord = ajzRecord;
    }

    public AjzFoodSafety getAjzFoodSafety() {
        return ajzFoodSafety;
    }

    public void setAjzFoodSafety(AjzFoodSafety ajzFoodSafety) {
        this.ajzFoodSafety = ajzFoodSafety;
    }

    public AjzNaturalGas getAjzNaturalGas() {
        return ajzNaturalGas;
    }

    public void setAjzNaturalGas(AjzNaturalGas ajzNaturalGas) {
        this.ajzNaturalGas = ajzNaturalGas;
    }

    public AjzLiquefiedGas getAjzLiquefiedGas() {
        return ajzLiquefiedGas;
    }

    public void setAjzLiquefiedGas(AjzLiquefiedGas ajzLiquefiedGas) {
        this.ajzLiquefiedGas = ajzLiquefiedGas;
    }
}